define(["jquery","template","bld/app/patient/specialtyBags.servers","bld/template/patient/specialtyBags.tpl"],function($,template,$servers,tpl){
	var ui = {};

	var drawScheme = function(data) {
        return template("tpl_specialtyBags_scheme", data);
    }
    var drawSidebar = function(data) {
        return template("tpl_specialtyBags_sidebar", data);
    }
    var drawTitle = function(data) {
        return template("tpl_specialtyBags_title", data);
    }
    var drawInfo = function(data) {
        return template("tpl_specialtyBags_info", data);
    }
    var drawTable = function(data) {
        return template("tpl_specialtyBags_table", data);
    }
    var drawContextmenu = function(data) {
        return template("tpl_specialtyBags_contextmenu", data);
    }
    var drawBatchModify = function(data) {
        return template("tpl_specialtyBags_batchModify", data);
    }
    var drawRecordModify = function(data) {
        return template("tpl_specialtyBags_recordModify", data);
    }
    var drawMedicineList = function(data) {
        return template("tpl_specialtyBags_medicineList", data);
    }
    var drawAdd = function(data) {
        return template("tpl_specialtyBags_add", data);
    }
    var drawSmallClass = function(data) {
        return template("tpl_specialtyBags_smallClass", data);
    }
    var drawStopSchemeReason = function(data) {
        return template("tpl_specialtyBags_stopSchemeReason", data);
    }
    var drawMedicationRecord = function(data) {
        return template("tpl_specialtyBags_medicationRecord", data);
    }
    var drawRemark = function(data) {
        return template("tpl_specialtyBags_remark", data);
    }
    var drawStatistics = function(data) {
        return template("tpl_specialtyBags_statistics", data);
    }
    var drawSelectCallBack = function(data) {
        return template("tpl_specialtyBags_select", data);
    }

	ui.scheme = function(options){
		$("#" + options.id).html(tpl.scheme());
        var h = drawScheme(options);
        $("#" + options.id).html(h);
	}
	ui.sidebar = function(options){
		$("#" + options.id).html(tpl.sidebar());
        var h = drawSidebar(options);
        $("#" + options.id).html(h);
	}
	ui.title = function(options){
		$("#" + options.id).html(tpl.title());
        var h = drawTitle(options);
        $("#" + options.id).html(h);
	}
	ui.info = function(options){
		$("#" + options.id).html(tpl.info());
        var h = drawInfo(options);
        $("#" + options.id).html(h);
	}
    ui.table = function(options){
        $("#" + options.id).html(tpl.table());
        var h = drawTable($servers.handleTable(options));
        $("#" + options.id).html(h);
    }
    ui.contextmenu = function(options){
        $("#contextmenu").html( tpl.contextmenu() );
        var html = drawContextmenu(options);
        $("#contextmenu").html(html);
    }
    ui.batchModify = function(options){
        options.dom.html( tpl.batchModify() );
        var html = drawBatchModify(options);
        options.dom.html(html);
    }
    ui.recordModify = function(options){
        options.dom.html( tpl.recordModify() );
        var html = drawRecordModify(options);
        options.dom.html(html);
    }
    ui.medicineList = function(options){
        options.dom.html( tpl.medicineList() );
        var html = drawMedicineList(options);
        options.dom.html(html);
    }
    ui.add = function(options) {
        options.dom.html(tpl.add());
        var h = drawAdd(options);
        options.dom.html(h);
    }
    ui.smallClass = function(options) {
        $("#" + options.id).html(tpl.smallClass());
        var h = drawSmallClass(options);
        $("#" + options.id).html(h);
    }
    ui.stopSchemeReason = function(options){
        options.dom.html(tpl.stopSchemeReason());
        var h = drawStopSchemeReason(options);
        options.dom.html(h);
    }
    ui.medicationRecord = function(options){
        options.dom.html(tpl.medicationRecord());
        var h = drawMedicationRecord(options);
        options.dom.html(h);
    }
    ui.remark = function(options){
        options.dom.html(tpl.remark());
        var h = drawRemark(options);
        options.dom.html(h);
    }
    ui.statistics = function(options){
        $("#" + options.id).html(tpl.statistics());
        var h = drawStatistics(options.data);
        $("#" + options.id).html(h);
    }
    ui.selectCallBack = function(options) {
        $("#" + options.id).html(tpl.selectCallBack());
        var h = drawSelectCallBack(options);
        $("#" + options.id).html(h);
    }

	return ui;
});